//    Copyright (C) Kherty.  All rights reserved.
namespace OpenLS.Spreadsheet.Extensibility
{
    public class TreatZeroEmptyAsFalseAttribute : ParameterConverterAttribute
    {
        internal override void ConvertImp(ConversionData data)
        {
            if (data.TargetType == typeof(bool))
            {
                object o = data.Value;
                if (o == null)
                {
                    data.Result = false;
                    return;
                }
                if (o is double)
                {
                    data.Result = ((double)o) != 0d;
                    return;
                }
            }
        }
    }
}